<!-- 简单窗口  只有标题 ，底部有 取消、完成 按钮 -->
<template>
  <div class="main-bg vh100">
    <div class="my-title drag" :style="{ lineHeight: titleHeight + 'px' }">{{ title }}</div>
    <slot></slot>

    <n-flex justify="center" v-if="showButtons">
      <n-button secondary @click="handleCancel">{{ cancelText }}</n-button>
      <n-button type="primary" :disabled="disabled" @click="handleConfirm">{{ confirmText }}</n-button>
    </n-flex>

  </div>
</template>

<script setup>
import { useCreateWindow } from "@/hooks/useCreateWindow.js";
const { closeCurrentWindow } = useCreateWindow()

defineProps({
  title: {
    type: String,
    default: ''
  },
  titleHeight: {
    type: Number,
    default: 28
  },
  disabled: {
    type: Boolean,
    default: true
  },
  cancelText: {
    type: String,
    default: '取消'
  },
  confirmText: {
    type: String,
    default: '完成'
  },
  showButtons: {
    type: Boolean,
    default: true
  }
})

const emits = defineEmits(['confirm'])
const handleConfirm = () => {
  emits('confirm')
}
const handleCancel = () => {
  closeCurrentWindow()
}

defineExpose({
  handleCancel
})

</script>

<style lang="scss" scoped>
.my-title {
  font-size: 14px ;
  text-align: center;
}
</style>
